# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=py3-pylsqpack
pkgver=0.3.18
_lsqpack_ver=1.0.3
pkgrel=0
pkgdesc="Python bindings for ls-qpack"
url="https://pypi.org/project/pylsqpack/"
arch="all"
license="BSD-3-Clause"
makedepends="
	bsd-compat-headers
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/aiortc/pylsqpack/archive/$pkgver/py3-pylsqpack-$pkgver.tar.gz
	https://github.com/litespeedtech/ls-qpack/archive/v$_lsqpack_ver/ls-qpack-$_lsqpack_ver.tar.gz
	"
builddir="$srcdir/pylsqpack-$pkgver"

prepare() {
	default_prepare

	rmdir "$builddir"/vendor/ls-qpack
	ln -s "$srcdir"/ls-qpack-$_lsqpack_ver "$builddir"/vendor/ls-qpack
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	find "$pkgdir" -name "*.c" -delete
}

sha512sums="
c8b9b3aeb73aad786f68fb7b06df9fb9c1288b20c1f88bf195393496abd42fe2cb86716054410df3c669f2cd32941142b93df3cbb0b6ea461a50ea9e28f4be74  py3-pylsqpack-0.3.18.tar.gz
dd6e14a86272c9784775e757d8a494f8d850ec98a5331e39be1f5e265ac94202e86ade963217ed5f3304512a3ce8a0dfc28e7798f9d6f19f496700ab5d5250a9  ls-qpack-1.0.3.tar.gz
"
